package com.sh.caryr.erp.entity.product;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.sh.caryr.erp.entity.BaseEntity;
import com.sh.caryr.erp.entity.enums.SalesPlatform;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@TableName("erp_product_mapping")
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper=true)
public class ProductMapping extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    private String img;

    /**
     * external product Id
     */
    private String extProId;

    /**
     * external product name
     */
    private String extProName;

    /**
     * 3rd-party extPlatform
     */
    private String extPlatform;

    public void setExtPlatform(String extPlatform) {
        this.extPlatform = extPlatform;
        SalesPlatform eco = SalesPlatform.getEnum(extPlatform);
        this.platformName = eco != null ? eco.getText() : "";
    }

    @TableField(exist=false)
    private String platformName;

    /**
     * ERP 产品规格ID
     */
    private Long productSpecId;

    @TableField(exist=false)
    private String productSpecName;

}
